<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<html>
	<head>
		<title>编辑个人信息</title>
		<script type="text/javascript">
			$(document).ready(function(){
				$("#userForm").validationEngine({
					promptPosition: "topLeft",
					ajaxFormValidation: true,
					onAjaxFormComplete: function (status, form, json, options){
						if (json === 1) {
							art.dialog.tips("<label class='success'>修改成功！</label>", 1);
			        		$("button").attr("disabled", true);
							window.parent.location.reload();
						}else{
							art.dialog.tips("<label class='error'>修改失败，请刷新页面重试！</label>", 1);
						}
					}
				});

				$("#undergraduateSchoolName").autocomplete("${ctx}/querySchoolName.html",{
					minChars: 0,
					width: 188,
					mustMatch: false,
					matchContains: true,
					extraParams:{
						keyword:function(){
							return $.trim($("#undergraduateSchoolName").val());
						}
					},
			        parse: function(data) {
			            return $.map(eval(data), function(row) {
			                return {
			                    data: row,
			                    value: row.name,
			                    result: row.name
			                }
			            });
			        },
			        formatItem: function(row, i, max) {
			        	return row.name + "( " + row.country + " )";
			        }
		    	}).result(function(event, row, formatted) {
		    		$("#undergraduateSchool").val(row.id);
	   			});


				$("#undergraduateMajorName").autocomplete("${ctx}/queryMajorName.html",{
					minChars: 0,
					width: 188,
					mustMatch: false,
					matchContains: true,
					extraParams:{
						keyword:function(){
							return $.trim($("#undergraduateMajorName").val());
						}
					},
			        parse: function(data) {
			            return $.map(eval(data), function(row) {
			                return {
			                    data: row,
			                    value: row.name,
			                    result: row.name
			                }
			            });
			        },
			        formatItem: function(row, i, max) {
			        	return row.name;
			        }
		    	}).result(function(event, row, formatted) {
		    		$("#undergraduateMajor").val(row.id);
	   			});


				$("#applyMajorName").autocomplete("${ctx}/queryMajorName.html",{
					minChars: 0,
					width: 188,
					mustMatch: false,
					matchContains: true,
					extraParams:{
						keyword:function(){
							return $.trim($("#applyMajorName").val());
						}
					},
			        parse: function(data) {
			            return $.map(eval(data), function(row) {
			                return {
			                    data: row,
			                    value: row.name,
			                    result: row.name
			                }
			            });
			        },
			        formatItem: function(row, i, max) {
			        	return row.name;
			        }
		    	}).result(function(event, row, formatted) {
		    		$("#applyMajor").val(row.id);
	   			});
			});
		</script>
	</head>
	<body>
		<div class="container_16">
			<div class="grid_16">
				<div class="content_top">
					<span>编辑个人信息</span>
				</div>
				<div class="content_bottom">
					<br />
					<form id="userForm" action="${ctx}/saveUserInfo.html" method="post">
						<input type="hidden" id="vipServiceId" name="vipServiceId" value="<s:property value="vipServiceId"/>">
						<input type="hidden" id="userInfoId" name="userInfo.id" value="<s:property value="userInfo.id"/>" />
						<input type="hidden" id="userId" name="user.id" value="<s:property value="user.id"/>">
						<table cellpadding="0" cellspacing="0" style="margin-left: 25px; width: 550px;">
							<tr>
								<td>
									<label>
										申请者：
									</label>
								</td>
								<td colspan="3">
									<s:property value="user.nickname" />
								</td>
							</tr>
							<tr>
								<td>
									<label>
										本科学校：
									</label>
								</td>
								<td>
									<input class="validate[required] input" type="text" id="undergraduateSchoolName" name="undergraduateSchoolName" value="<s:property value="userInfo.undergraduateSchoolName"/>">
									<input type="hidden" id="undergraduateSchool" name="userInfo.undergraduateSchool" value="<s:property value="userInfo.undergraduateSchool"/>">
								</td>
								<td>
									<label>
										本科专业：
									</label>
								</td>
								<td>
									<input class="validate[required] input" type="text" id="undergraduateMajorName" name="undergraduateMajorName" value="<s:property value="userInfo.undergraduateMajorName"/>">
									<input type="hidden" id="undergraduateMajor" name="userInfo.undergraduateMajor" value="<s:property value="userInfo.undergraduateMajor"/>">
								</td>
							</tr>
							<tr>
								<td>
									<label>
										申请专业：
									</label>
								</td>
								<td>
									<input class="validate[required] input" type="text" id="applyMajorName" name="applyMajorName" value="<s:property value="userInfo.applyMajorName"/>">
									<input type="hidden" id="applyMajor" name="userInfo.applyMajor" value="<s:property value="userInfo.applyMajor"/>">
								</td>
								<td>
									<label>
										入学年份：
									</label>
								</td>
								<td>
									<input class="validate[required] input" type="text" id="admissionYear" name="userInfo.admissionYear" value="<s:property value="userInfo.admissionYear"/>">
								</td>
							</tr>
							<tr>
								<td>
									<label>
										托福成绩：
									</label>
								</td>
								<td>
									<input class="validate[required] input" type="text" id="toefl" name="userInfo.toefl" value="<s:property value="userInfo.toefl"/>">
								</td>
								<td>
									<label>
										GER成绩：
									</label>
								</td>
								<td>
									<input class="validate[required] input" type="text" id="gre" name="userInfo.gre" value="<s:property value="userInfo.gre"/>">
								</td>
							</tr>
							<tr>
								<td>
									<label>
										本科GPA：
									</label>
								</td>
								<td>
									<input class="validate[required] input" type="text" id="undergraduateGpa" name="userInfo.undergraduateGpa" value="<s:property value="userInfo.undergraduateGpa"/>">
								</td>
								<td>
									<label>
										手机：
									</label>
								</td>
								<td>
									<input class="validate[required] input" type="text" id="phone" name="userInfo.mobilephone" value="<s:property value="userInfo.mobilephone"/>">
								</td>
							</tr>
							<tr>
								<td>
									<label>
										邮箱：
									</label>
								</td>
								<td>
									<input class="validate[required,custom[email]] input" type="text" id="email" name="user.email" value="<s:property value="user.email"/>">
								</td>
								<td>
									<label>
										QQ：
									</label>
								</td>
								<td>
									<input class="validate[required] input" type="text" id="qq" name="userInfo.qq" value="<s:property value="userInfo.qq"/>">
								</td>
							</tr>
							<tr>
								<td>
									&nbsp;
								</td>
								<td colspan="3">
									<label class="btn">
										<input type="submit" value="修改" />
									</label>
								</td>	
							</tr>
						</table>
					</form>
				</div>
			</div>		
		</div>
	</body>
</html>
